<template>
  <div>
    <div class="swiper-container banner">
      <div class="swiper-wrapper">
        <div class="swiper-slide">
          <img src="@/assets/banner1.jpg" alt="" class="slide" />
        </div>
        <div class="swiper-slide">
          <img src="@/assets/banner2.jpg" alt="" class="slide" />
        </div>
      </div>
      <!-- 如果需要分页器 -->
      <div class="swiper-pagination"></div>
    </div>
  </div>
</template>

<script>
import Swiper from "swiper";
export default {
  mounted() {
    new Swiper(".swiper-container", {
      // direction: 'vertical', // 垂直切换选项
      loop: true, // 循环模式选项
      autoplay: true,

      // 如果需要分页器
      pagination: {
        el: ".swiper-pagination",
      },

      // 如果需要前进后退按钮
      navigation: {
        nextEl: ".swiper-button-next",
        prevEl: ".swiper-button-prev",
      },
      // 如果需要滚动条
      // scrollbar: {
      //     el: '.swiper-scrollbar',
      // },
    });
  },
};
</script>

<style lang="scss" scoped>
.swiper-container {
  width: 100%;
  height: 500px;
  padding: 0;
}

.swiper-slide {
  width: 100% !important;
}

/* .banner .swiper-slide a {
    font-size: 0;
    width: 100%;
    height: 100%;
    position: relative;
    display: block;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
} */

.banner .slide {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
  max-width: 100%;
}

.banner .swiper-slide img {
  width: 100%;
}
</style>